*************************************************
*     How democratic is government really?      *  
* The impact of subnational regime variation on *
*            evaluations of democracy           *
*                                               * 
*	            Replication File                *
*                Amanda Fidalgo                 *
*************************************************



set more off

****Set your working directory and load data****
cd "C:\Users\aif08\Google Drive (afidalgo@ncf.edu)\Governance\Replication Files"
*Change the code above to match your working directory


*Load the data
use "Replication.dta", clear





******Replication of Tables 1-2 in the main manuscript

meologit humanrights SEDS finsat saving prescon govcon natpride polinterest inttrust govconf male age education income class  GNI popp parea  wave6 i.ctrycode || stateid:
est store mod1
xtmixed stdmalpractice SEDS finsat saving prescon govcon natpride polinterest inttrust govconf male age education income class  GNI popp parea  wave6 i.ctrycode || stateid:
est store mod2
xtmixed demsat SEDS finsat saving prescon govcon natpride polinterest inttrust govconf male age education income class  GNI popp parea  wave6 i.ctrycode || stateid:
est store mod3


esttab mod1 mod2 mod3 using "Table1.tex", se replace



******Replicating Figures 1 & 2 in the main manuscript

*Figure 1 
est restore mod1
quietly: margins,  at(SEDS=(-3(.1)1.1)    inttrust=0 natpride=4 polinterest=3 govconf=3 prescon=0 govcon=1 finsat=5 saving=3 male=1 age=41 education=5 income=4 class=3 ctrycode= 356 GNI=4.96 popp=7.27 parea=6.04)

marginsplot, graphregion(fcolor(white) ilcolor(white) lcolor(white)) ///
ysc(r(0 1)) ylabel(0(.1)1)  ///
legend(order(1 "No respect (1)" 2 "Not much respect (2)" 3 "Fairly much respect (3)" 4 "A great deal of respect (4)")) ///
title("Predicted Belief about Respect for Human Rights" "Average Respondent in India", size(large)) ///
xtitle("Subnational Democracy", size(medium)) ytitle("Predicted Probability", size(medium))  ///
recast(line) recastci(rline) ciopts(lpattern(dash))  xline(-.761)

graph export "Figure1.eps", as(eps) preview(off) replace


*Figure 2a
est restore mod2
quietly: margins,  at(SEDS=(-3(.1)1.1) inttrust=0 natpride=4 polinterest=3 govconf=3 prescon=0 govcon=1 finsat=5 saving=3 male=1 age=41 education=5 income=4 class=3 ctrycode= 356 GNI=4.96 popp=7.27 parea=6.04)

marginsplot, graphregion(fcolor(white) ilcolor(white) lcolor(white)) ///
ysc(r(40 100)) ylabel(40(10)100)  ///
title("Predicted Electoral Malpractice Index" "Average Respondent in India", size(large)) ///
xtitle("Subnational Democracy", size(medium)) ytitle("Predicted Electoral Malpractice Index", size(medium))  ///
recast(line) recastci(rline) ciopts(lpattern(dash)) xline(-.761)

graph export "Figure2a.eps", as(eps) preview(off) replace



*Figure 2b
est restore mod3
quietly: margins,  at(SEDS=(-3(.1)1.1) inttrust=0 natpride=4 polinterest=3 govconf=3 prescon=0 govcon=1 finsat=5 saving=3 male=1 age=41 education=5 income=4 class=3 ctrycode= 356)

marginsplot, graphregion(fcolor(white) ilcolor(white) lcolor(white)) ///
ysc(r(5 10)) ylabel(5(1)10)  ///
title("Predicted Democracy Scale" "Average Respondent in India", size(large)) ///
xtitle("Subnational Democracy", size(medium)) ytitle("Predicted Democracy Scale", size(medium))  ///
recast(line) recastci(rline) ciopts(lpattern(dash)) xline(-.761)

graph export "Figure2b.eps", as(eps) preview(off) replace



*Additional Marginal effects discussed in the main manuscript
	*Marginal effects estimated at the minimum, mean and maximum of the SEDS in India

est restore mod1
margins, at(SEDS=(-3 -.575 1.1) inttrust=0 natpride=4 polinterest=3 govconf=3 prescon=0 govcon=1 finsat=5 saving=3 male=1 age=41 education=5 income=4 class=3 ctrycode= 356 GNI=4.96 popp=7.27 parea=6.04)

est restore mod2
margins, at(SEDS=(-3 -.761 1.1) inttrust=0 natpride=4 polinterest=3 govconf=3 prescon=0 govcon=1 finsat=5 saving=3 male=1 age=41 education=5 income=4 class=3 ctrycode= 356 GNI=4.96 popp=7.27 parea=6.04)

est restore mod3
margins, at(SEDS=(-3 -.761 1.1) inttrust=0 natpride=4 polinterest=3 govconf=3 prescon=0 govcon=1 finsat=5 saving=3 male=1 age=41 education=5 income=4 class=3 ctrycode= 356 GNI=4.96 popp=7.27 parea=6.04)





******Models presented in the supplemental appendix 

*Replicating Table A5: Models using an alternative measure of the SEDS index 
meologit humanrights SEDS2 finsat saving prescon govcon natpride polinterest inttrust govconf male age education income class  GNI popp parea  wave6 i.ctrycode || stateid:
est store mod1a
xtmixed stdmalpractice SEDS2 finsat saving prescon govcon natpride polinterest inttrust govconf male age education income class  GNI popp parea  wave6 i.ctrycode || stateid:
est store mod2a
xtmixed demsat SEDS2 finsat saving prescon govcon natpride polinterest inttrust govconf male age education income class  GNI popp parea  wave6 i.ctrycode || stateid:
est store mod3a


esttab mod1a mod2a mod3a using "TableA5.tex", se replace



*Replicating Table A6: Breaking down the Electoral Malpractice Index
meologit oppcan  SEDS finsat saving prescon govcon natpride polinterest inttrust govconf male age education income class  GNI popp parea  wave6 i.ctrycode || stateid:
est store moda4
meologit TVbias  SEDS finsat saving prescon govcon natpride polinterest inttrust govconf male age education income class  GNI popp parea  wave6 i.ctrycode || stateid:
est store moda5
meologit voterbribe  SEDS finsat saving prescon govcon natpride polinterest inttrust govconf male age education income class  GNI popp parea  wave6 i.ctrycode || stateid:
est store moda6
meologit buyelect  SEDS finsat saving prescon govcon natpride polinterest inttrust govconf male age education income class  GNI popp parea  wave6 i.ctrycode || stateid:
est store moda7
meologit voteviolence  SEDS finsat saving prescon govcon natpride polinterest inttrust govconf male age education income class  GNI popp parea  wave6 i.ctrycode || stateid:
est store moda8

esttab moda4 moda5 moda6 moda7 moda8 using "TableA6.tex", se replace



*Replicating Table A7: Three-level models
meologit humanrights SEDS finsat saving prescon govcon natpride polinterest inttrust govconf male age education income class  GNI popp parea  wave6 || ctrycode: || stateid:
est store moda9
xtmixed stdmalpractice SEDS finsat saving prescon govcon natpride polinterest inttrust govconf male age education income class  GNI popp parea  wave6 || ctrycode: || stateid:
est store moda10
xtmixed demsat SEDS finsat saving prescon govcon natpride polinterest inttrust govconf male age education income class  GNI popp parea  wave6 || ctrycode: || stateid:
est store moda11

esttab moda9 moda10 moda11 using "TableA7.tex", se replace



*Replicating Table A8: Models with additional individual and state level control varaibles
meologit humanrights   SEDS finsat saving prescon govcon natpride polinterest inttrust govconf male age education income class  religimport i.relig religatt i.marital popp parea SHDI wave6 i.ctrycode || stateid:
est store moda12
xtmixed stdmalpractice SEDS finsat saving prescon govcon natpride polinterest inttrust govconf male age education income class  religimport i.relig religatt i.marital popp parea SHDI wave6 i.ctrycode || stateid:
est store moda13
xtmixed demsat 		   SEDS finsat saving prescon govcon natpride polinterest inttrust govconf male age education income class  religimport i.relig religatt i.marital popp parea SHDI wave6 i.ctrycode || stateid:
est store moda14


esttab moda12 moda13 moda14 using "TableA8.tex", se replace


 
 
*Replicating Table A9: Breaking down the Electoral integrity scale
  
xtmixed stdEIS SEDS finsat saving prescon govcon natpride polinterest inttrust govconf male age education income class  GNI popp parea  wave6 i.ctrycode || stateid:
est store moda15
meologit fairelectoff SEDS finsat saving prescon govcon natpride polinterest inttrust govconf male age education income class  GNI popp parea  wave6 i.ctrycode || stateid:
est store moda16
meologit electchoice SEDS finsat saving prescon govcon natpride polinterest inttrust govconf male age education income class  GNI popp parea  wave6 i.ctrycode || stateid:
est store moda17
meologit fairjournalists SEDS finsat saving prescon govcon natpride polinterest inttrust govconf male age education income class  GNI popp parea  wave6 i.ctrycode || stateid:
est store moda18
meologit fairvote SEDS finsat saving prescon govcon natpride polinterest inttrust govconf male age education income class  GNI popp parea  wave6 i.ctrycode || stateid:
est store moda19

esttab moda15 moda16 moda17 moda18 moda19 using "Table A9.tex", se replace






*For more on the Subnational Electoral Democracy Scale, 
*please see the codebook and replication code for this measure 
*Here: https://doi.org/10.7910/DVN/OPD3LW









